<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>水平走马灯效果</title>
    <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: 'Arial', sans-serif;
        }

        /* 容器样式 */
        .swiper-container {
            width: 100%;
            height: 900px; /* 设置容器的高度 */
            padding:20px;
            cursor: grab;
        }

        /* 图片样式 */
        .swiper-slide img {
            width: calc(373 * 0.8)px;
            height: calc(808 * 0.8)px;
            margin-right: 25px;
            border-radius: 15px;
            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        /* 图片的鼠标悬停效果 */
        .swiper-slide img:hover {
            transform: scale(1.05);
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
        }
        .swiper-wrapper{
            display: flex;
        }
    </style>
</head>

<body>

    <!-- Swiper 容器 -->
    <div class="swiper-container">
        <!-- 包含图片的 swiper-wrapper -->
        <div class="swiper-wrapper">
            <!-- 单个图片项 -->
            <div class="swiper-slide"><img src="./banner/mobile01.png" alt="Image 1"></div>
            <div class="swiper-slide"><img src="./banner/mobile02.png" alt="Image 2"></div>
            <div class="swiper-slide"><img src="./banner/mobile03.png" alt="Image 3"></div>
            <div class="swiper-slide"><img src="./banner/mobile04.png" alt="Image 4"></div>
            <div class="swiper-slide"><img src="./banner/mobile05.png" alt="Image 5"></div>
            <div class="swiper-slide"><img src="./banner/mobile06.png" alt="Image 6"></div>
            <div class="swiper-slide"><img src="./banner/mobile07.png" alt="Image 7"></div>
            <div class="swiper-slide"><img src="./banner/mobile08.png" alt="Image 8"></div>
            <div class="swiper-slide"><img src="./banner/mobile09.png" alt="Image 9"></div>
            <!-- 复制图片以实现无缝滚动效果 -->
            <div class="swiper-slide"><img src="./banner/mobile01.png" alt="Image 1"></div>
            <div class="swiper-slide"><img src="./banner/mobile02.png" alt="Image 2"></div>
            <div class="swiper-slide"><img src="./banner/mobile03.png" alt="Image 3"></div>
            <div class="swiper-slide"><img src="./banner/mobile04.png" alt="Image 4"></div>
            <div class="swiper-slide"><img src="./banner/mobile05.png" alt="Image 5"></div>
            <div class="swiper-slide"><img src="./banner/mobile06.png" alt="Image 6"></div>
            <div class="swiper-slide"><img src="./banner/mobile07.png" alt="Image 7"></div>
            <div class="swiper-slide"><img src="./banner/mobile08.png" alt="Image 8"></div>
            <div class="swiper-slide"><img src="./banner/mobile09.png" alt="Image 9"></div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
    </div>

    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
    <script>
        // 初始化 Swiper
        const swiper = new Swiper('.swiper-container', {
            slidesPerView: 3,  // 显示多张图片
            spaceBetween: 2,       // 图片之间的间距
            loop: true,             // 启用循环滚动
            grabCursor: true,       // 启用拖拽光标
            autoplay: {
                delay: 0,           // 自动滚动的间隔为0
                disableOnInteraction: false,  // 用户拖动后继续自动滚动
            },
            speed: 5000,            // 滚动速度
            direction: 'horizontal', // 水平滚动
            loopAdditionalSlides: 5, // 增加额外的幻灯片来避免“跳跃”
        });
    </script>
</body>

</html>
